package com.ewhale.feitengguest.api;

import androidx.annotation.AnyRes;

import com.ewhale.feitengguest.dto.BannerDto;
import com.ewhale.feitengguest.dto.ClassificationDto;
import com.ewhale.feitengguest.dto.EditTaskDto;
import com.ewhale.feitengguest.dto.NavigationDto;
import com.ewhale.feitengguest.dto.RankDto;
import com.ewhale.feitengguest.dto.ShopTaskDetailDto;
import com.ewhale.feitengguest.dto.ShopTaskDto;
import com.ewhale.feitengguest.dto.SubmitDetailDto;
import com.ewhale.feitengguest.dto.TaskCommentDto;
import com.ewhale.feitengguest.dto.TaskDetailsDto;
import com.ewhale.feitengguest.dto.TaskListDto;
import com.ewhale.feitengguest.dto.WaitHandleDto;
import com.simga.library.dto.EmptyDto;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Url;

public interface TaskApi {

    /**
     * 获取首页广告页
     *
     * @return
     */
    @POST("app/banner/getBannerList.json")
    Observable<List<BannerDto>> getBannerList();

    /**
     * 获取轮播图详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/banner/getH5Content.json")
    Observable<String> getBannerDetail(@Field("bannerId") long bannerId);


    /**
     * 获取任务分类
     *
     * @return
     */
    @POST("app/common/getAllClassificationList.json")
    Observable<List<ClassificationDto>> getAllClassificationList();

    @POST("app/shop/findClassificationList.json")
    Observable<List<ClassificationDto>> getAllClassificationList2();

    /**
     * 获取任务列表
     *
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/findMissionByPageList.json")
    Observable<List<TaskListDto>> getTaskList(@Field("pageNumber") Integer pageNumber,
                                              @Field("pageSize") Integer pageSize,
                                              @Field("classificationId") Integer classificationId,
                                              @Field("deviceType") Integer deviceType);

    /**
     * 搜索任务
     *
     * @param pageNumber
     * @param pageSize
     * @param title
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/findMissionByPageList.json")
    Observable<List<TaskListDto>> getTaskList(@Field("pageNumber") Integer pageNumber,
                                              @Field("pageSize") Integer pageSize,
                                              @Field("title") String title,
                                              @Field("deviceType") Integer deviceType);

    /**
     * 获取任务详情
     *
     * @param missionId
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/findMissionDetailByMissionId.json")
    Observable<TaskDetailsDto> getTaskDetail(@Field("missionId") long missionId);

    /**
     * 取消任务
     *
     * @param missionId
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/cancelMission.json")
    Observable<EmptyDto> cancelTask(@Field("missionId") long missionId);

    /**
     * 获取任务留言列表
     *
     * @param missionId
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/seeMessage.json")
    Observable<List<TaskCommentDto>> getTaskComment(@Field("missionId") long missionId,
                                                    @Field("pageNumber") Integer pageNumber,
                                                    @Field("pageSize") Integer pageSize);

    /**
     * 商家查看评论
     *
     * @param missionId
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/seeMessage.json")
    Observable<List<TaskCommentDto>> getTaskCommentByShop(@Field("missionId") long missionId,
                                                          @Field("pageNumber") Integer pageNumber,
                                                          @Field("pageSize") Integer pageSize);

    /**
     * 留言
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/leaveMessage.json")
    Observable<EmptyDto> leaveMessage(@FieldMap Map<String, Object> params);

    /**
     * 接任务
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/mission/acceptMission.json")
    Observable<EmptyDto> acceptMission(@Field("missionId") long missionId);

    /**
     * 首页标签
     *
     * @return
     */
    @POST("app/banner/getNavigationList.json")
    Observable<List<NavigationDto>> getNavigationList();

    /**
     * 邀请榜单
     *
     * @return
     */
    @POST("app/banner/getRanking.json")
    Observable<RankDto> getRanking();

    /**
     * 上一期榜单
     *
     * @return
     */
    @POST("app/banner/getRankingBefore.json")
    Observable<String> getLastRanking();

    /**
     * 待处理订单
     *
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getWaitHandleList.json")
    Observable<List<WaitHandleDto>> getShopWaitHandle(@Field("pageNumber") Integer pageNumber,
                                                      @Field("pageSize") Integer pageSize);

    /**
     * 待处理订单
     *
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getShopMissionList.json")
    Observable<List<ShopTaskDto>> getShopTaskList(@Field("pageNumber") Integer pageNumber,
                                                  @Field("pageSize") Integer pageSize,
                                                  @Field("status") Integer status);


    /**
     * 余额支付  提价任务
     *
     * @param params
     * @return
     */
    @POST("app/shop/missionOrderPayByWallet.json")
    @Headers("Content-Type: application/json")
    Observable<EmptyDto> missionOrderPayByWallet(@Body Map<String, Object> params);

    /**
     * 第三方支付 提价任务
     *
     * @param params
     * @return
     */
    @POST("app/shop/missionOrderPayByThird.json")
    @Headers("Content-Type: application/json")
    Observable<Object> missionOrderPayByThird(@Body Map<String, Object> params);

    /**
     * 删除任务
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/deleteMission.json")
    Observable<EmptyDto> deleteMission(@Field("id") Long id);

    /**
     * 结束任务
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/overMission.json")
    Observable<EmptyDto> overMission(@Field("id") Long id);

    /**
     * 关闭或开启任务
     *
     * @param id
     * @param status 0-否 1-是
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/updateMissionStopStatus.json")
    Observable<EmptyDto> updateMissionStopStatus(@Field("id") Long id,
                                                 @Field("status") Integer status);

    /**
     * 编辑任务的回显
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/editMission.json")
    Observable<EditTaskDto> editMission(@Field("id") Long id);

    /**
     * 商家端任务详情
     *
     * @param missionId
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/findMissionDetailByMissionId.json")
    Observable<ShopTaskDetailDto> findMissionDetailByMissionId(@Field("missionId") Long missionId);

    /**
     * 涨价  或  增加名额
     * 余额支付
     *
     * @param url
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST
    Observable<EmptyDto> increaseWallet(@Url String url,
                                        @FieldMap Map<String, Object> params);

    /**
     * 涨价  或  增加名额
     * 第三方支付
     *
     * @param url
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST
    Observable<Object> increaseThirdPay(@Url String url,
                                        @FieldMap Map<String, Object> params);

    /**
     * 获取提交订单
     *
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getSubmitListByMissionId.json")
    Observable<List<WaitHandleDto>> getSubmitListByMissionId(@Field("missionId") Long missionId,
                                                             @Field("status") Integer status,
                                                             @Field("pageNumber") Integer pageNumber,
                                                             @Field("pageSize") Integer pageSize);

    /**
     * 用户提交任务详情
     *
     * @param taskId
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/getSubmitDetail.json")
    Observable<SubmitDetailDto> getSubmitDetail(@Field("Id") Long taskId);

    /**
     * 审核用户
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/updateAccountMissionStatus.json")
    Observable<EmptyDto> updateAccountMissionStatus(@FieldMap Map<String, Object> params);

    /**
     * 商家回复
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("app/shop/replyContent.json")
    Observable<EmptyDto> replyContent(@Field("messageId") Long messageId,
                                      @Field("replyContent") String replyContent);
}
